<div id="pageoptions">
    <% if @params[:relationship_id] %>
        <%= link_to "< back to shared story", {# link_to options
            :controller => 'story',
            :action => 'view',
            :id => @story_id,
            :relationship_id => @params[:relationship_id]} %>
    <% else %>
        <%= link_to "< back to story", {# link_to options
                :controller => 'story',
                :action => 'view',
                :id => @story_id} %>
    <% end %>
</div>
<%= error_messages_for 'category' %>

<div class="sectionwrap">
    <% form_for :category, :url => { :relationship_id => @params[:relationship_id] } do |form| %>
        <% for category in @categories %>
            <input id="story_category_id" name="category_ids[]" value="<%= category.id %>" <%= if @story_categories.include?(category) then " checked " end %> type="checkbox"> <%= category.title %><br/>
        <% end %>
        <br/>
        <%= submit_tag "Update Categories", :class => "submit" %>
        <br/><br/>
    <% end %>
</div>